/**
 * @fileoverview Script to update the eslint:all configuration.
 * @author Nicholas C. Zakas
 */

"use strict";

//-----------------------------------------------------------------------------
// Requirements
//-----------------------------------------------------------------------------

const fs = require("node:fs");
const builtInRules = require("../lib/rules");

//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------

const allRules = {};

for (const [ruleId, rule] of builtInRules) {
	if (!rule.meta.deprecated) {
		allRules[ruleId] = "error";
	}
}

//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------

const code = `/*
 * WARNING: This file is autogenerated using the tools/update-eslint-all.js
 * script. Do not edit manually.
 */
"use strict";

module.exports = Object.freeze({
    name: "@eslint/js/all",
    rules: Object.freeze(${JSON.stringify(allRules, null, 4).replaceAll(
		"\n",
		"\n    ",
	)})
});
`;

fs.writeFileSync("./packages/js/src/configs/eslint-all.js", code, "utf8");
